Select Excel Range

IronXL for Python makes it easy to select and work with ranges in any Excel WorkSheet. The code below demonstrates how ranges, rows, and columns can be selected. After selection, aggregate methods such as SortAscending(), SortDescending(), Sum(), Max(), Min(), and Average() can be applied to the collected data. Note that when methods modify or move cell values, the affected range, row, or column will reflect those changes accordingly.

Range

To select a range from A2 to A8, use range_ = worksheet["A2:A8"].

Row

To select row 1, use worksheet.GetRow(0). Indexing is zero-based. The range of cells returned is determined by the union of all populated cells across all rows, including row 1 itself.

Column

To select column A, use worksheet.GetColumn(0) or assign the range address as worksheet["A:A"]. The range of cells is determined by the union of all populated cells across all columns, including column A itself.

How to Select an Excel Range in Python

  1. Install IronXL for Python to select Excel ranges.
  2. Load an existing workbook or create a new one.
  3. Select the target worksheet from the workbook.
  4. Use worksheet["A2:A8"] to select a range from A2 to A8.
  5. Use GetColumn and GetRow methods to select individual columns and rows.

Explore How to Select Excel Ranges with Python and IronXL.

Ready to Get Started?
Version: 2026.4 just released
Still Scrolling Icon

Still Scrolling?

Want proof fast?
run a sample watch your data become a spreadsheet.